1. Field of the Invention
The present invention relates to a system and method for automatically generating source code example files for an application program, wherein source code example files are automatically generated for a plurality of different programming languages and/or a plurality of different operating systems.
2. Description of the Related Art
Many application programs are distributed with examples which illustrate or exemplify operation of the application program. In many instances, the application program includes examples in a number of different programming languages. For example, NI-DAQ, the device driver and Windows driver library set for National Instruments Data Acquisition (DAQ) devices, is generally distributed with code examples in Microsoft Visual C++, Microsoft Visual Basic, and Borland C++.
In the NI-DAQ application program, the code examples generally had the following characteristics. First, each example included extensive Windows graphical user interface (GUI) code, so that the user could easily change key data acquisition parameters while running the example program. Second, each example accommodates a wide variety of DAQ devices. However, not all devices were supported by all NI-DAQ functions. Therefore, each example implemented run-time branching to make device specific function calls. Thirdly, each example was written individually for each language and three different Windows operating system (OS) versions (3.1x, 95, and NT), each taking advantage of the programming language specific features through language and OS specific project files. Finally, each example was delivered in the form of source code and ready-to-run executables.
While each delivered example illustrated an important aspect of using the NI-DAQ dynamic link library (DLL) through the exported application programming interface (API) calls, they had the following shortcomings with respect to the above mentioned characteristics. First, it was very difficult to find the few NI-DAQ function calls located in the few hundred lines of GUI code. In one example, there were 340 lines of code, which only included 2 lines of NI-DAQ function calls. Thus the NI-DAQ programming example resembled a Windows programming tutorial. Secondly, when the NI-DAQ driver set was upgraded to include support for new data acquisition (DAQ) devices, a programmer had to maintain the different versions of the examples for each programming language and OS. Thirdly, when a new version of the programming language was released (e.g.: Microsoft Visual C++ 5.0), the project files were required to be upgraded due to compatibility issues. Also, each example used slightly different sequences of function calls, which required that support personnel know the subtle differences between the examples. Fourthly, the size of the executables and/or run-time engines (e.g. the Visual Basic 3.0 run-time DLL is over 700 kB) required to run the executables required increased amounts of disk space for the installation media (1.44 MB floppies). Fifthly, the examples included no information on how physical signals were to be connected to the data acquisition devices while being used with these examples.
Finally, customers typically requested "code snippets", which are concisely written source code files showing how to perform a certain task. The customer support engineers were thus required to spend time writing these short examples for customers.
Due to the above shortcomings and the large amount of required maintenance for the example source code, application developers were reluctant to provide a large number of examples to the users. The NI-DAQ library is a versatile driver library which supports over 50 different DAQ devices and signal conditioning units, as well as a wide variety of tasks for each DAQ device. Although the NI-DAQ User Manual did explain in flow charts how to use the set of NI-DAQ functions to perform various basic data acquisition tasks, the nature of the API calls required detailed expertise when it came to programming. Without examples, customers had a very difficult time programming with the NI-DAQ function calls.
Therefore, an improved system and method is desired for easily generating example programs for an application program, preferably in a plurality of different programming languages and/or for a plurality of different operating systems.